package cn.itcast.zt.java8.model.chain.demo1;

/**
 * 密码校验处理
 * @author zhangtian105
 * @date 2023/2/1
 * @apiNote
 */
public class PasswordCheckFilter extends UserLoginCheckFilter{
    public PasswordCheckFilter(UserLoginCheckFilter userLoginCheckFilter) {
        super(userLoginCheckFilter);
    }

    @Override
    public UserLoginCheckFilter getNextFilter() {
        return super.getNextFilter();
    }

    @Override
    public boolean process(UserWrapper userWrapper) {
        if(null == userWrapper.getLoginBo()){
            throw new RuntimeException("密码错误");
        }

        return getNextFilter() == null ? true : getNextFilter().process(userWrapper);
    }
}
